package design._01_factory.simple1._02;
/**
 * 即是抽象产品类，又是工厂类
 * @author nrzt
 *
 */
public abstract class AbstractChart implements Chart{
	//获得实例对象
	public static Chart getChart(String type) {
		Chart chart = null;
		if (type.equalsIgnoreCase("histogram")) {
			chart = new HistogramChart();
			System.out.println("初始化设置柱状图！");
		}else if (type.equalsIgnoreCase("pie")) {
			chart = new PieChart();
			System.out.println("初始化设置饼状图！");
		}else if (type.equalsIgnoreCase("line")) {
			chart = new LineChart();
			System.out.println("初始化设置折线图！");
		}
		return chart;		
	}
}	
